<template>
	<view class="steps">
		<view class="steps-wrap">
			<view class="steps-item" v-for="(item,index) in options" :key="index">
				<view class="steps-item-left">
					<view class="steps-item-line steps-item-line--before" :style="{backgroundColor:index<=active&&index!==0?activeColor:index===0?'transparent':color}"></view>
					<view class="steps-item-check" v-if="index === active">
						<uni-icons :color="activeColor" type="checkbox-filled" size="14"></uni-icons>
					</view>
					<template v-else>
						<view class="steps-item-speed" v-if="speed" :style="{backgroundColor:index<active?activeColor:color}">
							{{item[speedKey]}}%
						</view>
						<view class="steps-item-circle" v-else :style="{backgroundColor:index<active?activeColor:color}"></view>
					</template>
					<view class="steps-item-line steps-item-line--after" :style="{backgroundColor: index<active&&index!==options.length-1?activeColor:index===options.length-1?'transparent':color}"></view>
				</view>
				<view class="steps-item-right">
					<view class="steps-item-card">
						<view>
							<text class="f34">{{item.title}}</text>
							<text class="f24 ml20 gray">进度 {{item[speedKey]}}%</text>
						</view>
						<view class="f28 mt10">{{item.desc}}</view>
						<view class="f28 mt10">开始时间：{{item.time}}</view>
						<view class="f28 mt10">预估时间：2021-12-21</view>
						<view class="f28 mt10">负责人：小A 130xxxxxxx</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'mo-steps',
		props: {
			options: {
				type: Array,
				default: ()=>[]
			},
			active: {
				type: Number,
				default: 0
			},
			activeColor: {
				// 激活状态颜色
				type: String,
				default: '#1aad19'
			},
			color: {
				// 未激活状态颜色
				type: String,
				default: '#cccccc'
			},
			speed: {
				type: Boolean,
				default: false
			},
			speedKey: {
				type: String,
				default: 'speed'
			}
		},
		data() {
			return {				
				httpsUrl: ''
			}
		}, 
		computed: {

		},
		created(){
			this.httpsUrl = this.$httpsUrl
		},
		methods: {
           	openPage(){
            },
		}
	}
</script>


<style lang="scss" scoped>
	$theme-color: #f40;
	.gray{ color: #999; }
	.mt10{margin-top: 10rpx;}
	.ml10{margin-left: 10rpx;}
	.ml20{margin-left: 20rpx;}
	.f34{font-size: 34rpx;}
	.f32{font-size: 32rpx;}
	.f28{font-size: 28rpx;}
	.f26{font-size: 26rpx;}
	.f24{font-size: 24rpx;}
	.ellipsis {
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
	}
	.steps{
		/* #ifndef APP-NVUE */
		display: flex;
		width: 100%;
		/* #endif */
		/* #ifdef APP-NVUE */
		flex: 1;
		/* #endif */
		flex-direction: column;
		&-wrap{
		}
		&-item{
			display: flex;
			&-left{
				width: 72rpx;
				/* #ifndef APP-NVUE */
				display: flex;
				/* #endif */
				flex-direction: column;
				align-items: center;
				justify-content: center;
			}
			&-right{
				flex: 1;
				padding-bottom: 30rpx;
			}
			&-card{
				background-color: #f5f5f5;
				padding: 20rpx 30rpx 30rpx;
				border-radius: 10rpx;
				margin-right: 30rpx;
			}
			&-line{
				width: 1px;
				background-color: #999;
				&--before {
					height: 30rpx;
					transform: translate(0px, -1px);
				}
				&--after {
					flex: 1;
					transform: translate(0px, 1px);
				}
			}
			&-check{
			}
			&-speed{
				font-size: 24rpx;
				padding: 10rpx;
				color: #fff;
				border-radius: 100px;
				background-color: #999;
				margin: 4px 0px 5px 0px;
			}
			&-circle{
				width: 5px;
				height: 5px;
				border-radius: 100px;
				background-color: #999;
				margin: 4px 0px 5px 0px;
			}
		}
	}
</style>
